define(function(require,exports,module){
	
	
	$("#J_cash").attr("action","/member/cash/doCash.html");
	
	require.async('radio',function(){
		$('.cashCardList input[type="radio"]').minRadio({
			checkedClass:"bank_radio_hover", 
			Element:"bank_radio",	
			showTxt:true 
		});	
	});
	
	//判断是否已认证或开通第三方接口
	$.ajax({
		url:"/member/useridentify/realNameStatus.html?randomTime=" + (new Date()).getTime(),
		type:"get",
		dataType:"json",
		success:function(data){
			require.async(['/plugins/layer-v1.8.4/skin/layer.css','/plugins/layer-v1.8.4/layer.min'],function(){
			if(data.result==false){
					/*if(depositVal==0){*/
						$.layer({
							type: 1,
							closeBtn: false,
			                title: "&nbsp;",
						    area: ['450px', '190px'],
						    border: [1, 1, '#cecfd0'],
						    page: {
						        html: '<div class="tipsWrap w450"><div class="tipsTxt"><i class="iconfont tipIco">&#xe63c;</i><span>您尚未通过实名认证，请先认证。</span></div><div class="tipsBtnBar"><a href="/member/security/setting.html" class="okBtn">马上去认证</a></div></div>'
						    }
						});
			}
			});
			
		}
	})
	
	require.async("/plugins/jquery-validation-1.13.0/jquery.validate",function(){
		require.async("/plugins/jquery-validation-1.13.0/additional-methods",function(){
			$("#J_cash").validate({
					ignore:".ignore",
					rules: {
						money: {
							required: true,
							max:parseFloat($("#available_Balance").text().replace(/[^\d]/g,'')),
							min:0.01
						},
						payPwd:{
							required:true
						}
					},
					messages:{
						money: {
							required: "请输入提现金额",
							max:"提现金额不能大于您的可用余额",
							min:"不能小于0.01元"
						},
						payPwd:{
							required: "请输入交易密码",
						}
					},
					errorElement:"em",
					errorPlacement:function(error,element){
						error.appendTo(element.parent().find("span"));
					},
					submitHandler:function(form,event,vaildator){
						require.async(['/plugins/layer-v1.8.4/skin/layer.css','/plugins/layer-v1.8.4/layer.min'],function(){ 
							require.async('jquery.form',function(){
								$(form).ajaxSubmit({
			    					dataType:'json',
			    					success:function(data){
							        	if(data.result==true){
							        		$.layer({
												type: 1,
												closeBtn: false,
								                title: "&nbsp;",
											    area: ['450px', '190px'],
											    border: [1, 1, '#cecfd0'],
											    page: {
											        html: '<div class="tipsWrap w450"><div class="tipsTxt"><i class="iconfont tipIco">&#xe63c;</i><span>提现申请成功，等待系统审核！</span></div><div class="tipsBtnBar"><a href="javascript:;" class="okBtn">确认</a><a href="javascript:;" class="cancleBtn">取消</a></div></div>'
											    }
											});	
											$(".okBtn").click(function(){
												window.location.href = "/member/cash/log.html";
											});
											$(".cancleBtn").click(function(){
												window.location.reload();	
											});
							        	}else{
							        		$.layer({
												type: 1,
											    closeBtn: [0,true],
								                title: "&nbsp;",
											    area: ['384px', '186px'],
											    border: [1, 1, '#cecfd0'],
											    page: {
											        html: '<div class="tipsWrap w384"><div class="tipsTxt"><i class="iconfont errIco">&#xe63e;</i><span>'+data.msg+'</span></div><div class="tipsBtnBar"><a href="javascript:;" class="okBtn failBtn">确定</a></div></div>'
											    },
											    close: function(index){
											    	layer.closeAll();
											    }
											});
											$(".failBtn").click(function(){
												layer.closeAll();
											});
							        	}
			    					}
			    				}); 
							  })
					});	
					}
				});
		});
	});
});